package com.example.demo.manager;

import org.activiti.engine.impl.interceptor.Session;
import org.activiti.engine.impl.interceptor.SessionFactory;
import org.activiti.engine.impl.persistence.entity.UserIdentityManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description:  替换activiti的GroupEntityManagerFactory
 * @Author: zsg
 * @Date: 2018/07/10 17:13
 */
@Service
public class CustomUserEntityManagerFactory implements SessionFactory {

    @Autowired
    private CustomUserEntityManager customUserEntityManager;

    @Override
    public Class<?> getSessionType() {
        //注意此处必须为Activiti原生的类，否则自定义类不会生效
        return UserIdentityManager.class;
    }

    @Override
    public Session openSession() {
        return  customUserEntityManager;
    }

}
